package com.coastline.fruit.common.thread;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 定时任务线程池
 *
 * @author Coastline
 * @date 2025/1/10 23:36
 */
public class TaskScheduledThread {
    private static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor;

    /**
     * 创建定时任务线程池
     *
     * @return scheduledThreadPoolExecutor 线程池执行器
     */
    public static ScheduledThreadPoolExecutor getExecutorService() {
        scheduledThreadPoolExecutor = CoastlineThreadPoolManager.createThreadPool("TaskScheduledThread" ,
                20, new CoastlineDefaultThreadFactory("TaskScheduledThread-"), new ThreadPoolExecutor.CallerRunsPolicy());
        return scheduledThreadPoolExecutor;
    }
}
